﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>运动员登录</title>
    <link href="<%=Url.Content("~/Content/reg.css") %>" rel="stylesheet" type="text/css" />

    <script src="../../Scripts/jquery-1.4.4.js" type="text/javascript"></script>

    <script type="text/javascript" language="javascript">
        function save() {
            //有效性判断
            var flag = 0;
            if ($("#playerno").val() == "") {
                alert("请输入学号！");
                return;
            }
            if ($("#password").val() == "") {
                alert("请输入密码！");
                return;
            }
            $.ajax({
                type: "post",
                dataType: "json",
                url: '<%=Url.Action("CheckPlayerInfo")%>',
                data: { "playerno": $("#playerno").val(), "password": $("#password").val() },
                success: function(data) {
                    if (data == false) {
                        alert("登录失败，用户名和密码不正确！");
                    }
                    else {
                        $("#form1").submit();
                    }
                },
                error: function(data) {
                    alert("AJAX数据获取报错！");
                }
            });
        }
    </script>

</head>
<body>
    <table width="750" style="background-image: url(../../Content/images/reg/header_bg.png)"
        height="70" cellspacing="0" cellpadding="0" border="0" align="center">
        <tr>
            <td>
                <img src="../../Content/images/reg/logo.png" style="margin-left: 5px;" />
            </td>
        </tr>
    </table>
    <table width="750" height="176" cellspacing="1" cellpadding="0" border="0" align="center">
        <tr>
            <td bgcolor="#ffffff">
                <table width="100%" cellspacing="0" cellpadding="2" border="0">
                    <tr>
                        <td width="180" valign="top" style="border-right: 1px solid rgb(28, 183, 205); background: none repeat scroll 0% 0% rgb(208, 241, 247);
                            border-bottom: 1px solid rgb(28, 183, 205);">
                            <table width="100%" cellspacing="0" cellpadding="2" border="0">
                                <tr>
                                    <td height="33" background="../../Content/images/reg/bmbz.gif">
                                        &nbsp;
                                    </td>
                                </tr>
                            </table>
                            <table width="176px" cellspacing="0" align="right" cellpadding="3" border="0">
                                <tr>
                                    <td bgcolor="#ffffff">
                                        <br />
                                    </td>
                                </tr>
                                <tr>
                                    <td bgcolor="#ffffff">
                                        ①阅读报名须知<br />
                                    </td>
                                </tr>
                                <tr>
                                    <td bgcolor="#ffffff">
                                        ②填写个人信息<br />
                                    </td>
                                </tr>
                                <tr>
                                    <td bgcolor="#ffffff">
                                        ③选择报名项目<br />
                                    </td>
                                </tr>
                                <tr>
                                    <td bgcolor="#ffffff">
                                        ④确认报名信息<br />
                                    </td>
                                </tr>
                                <tr>
                                    <td bgcolor="#ffffff">
                                        ⑤完成报名<br />
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td valign="top" bgcolor="#fcfcfc">
                            <%using (Html.BeginForm("Login", "Reg", FormMethod.Post, new { id = "form1" }))
                              {%>
                            <table width="99%" cellspacing="1" cellpadding="1" border="1" bgcolor="#f7f7f7" align="center"
                                class="text" bordercolordark="#Ffffff" bordercolorlight="#cccccc">
                                <tr bgcolor="#ffffff">
                                    <td height="30" bgcolor="#e8e8e8">
                                        <div align="center">
                                            <font size="2" color="#000000"><strong><font color="#ff3300">第1步</font></strong> <strong>
                                                运动员登录</strong></font></div>
                                    </td>
                                </tr>
                                <tr bgcolor="#ffffff">
                                    <td valign="top" bgcolor="#ffffff" background="../image/water_bg.gif">
                                        <table cellspacing="1" cellpadding="5" border="0" bgcolor="#efefef" align="center"
                                            width="100%">
                                            <tr bgcolor="#f5f7f8">
                                                <td align="right">
                                                    学&nbsp;&nbsp;&nbsp;&nbsp;号：
                                                </td>
                                                <td>
                                                    <input name="playerno" id="playerno" type="text" />
                                                    <font color="red">*&nbsp;&nbsp;</font>
                                                </td>
                                            </tr>
                                            <tr bgcolor="#f5f7f8">
                                                <td align="right">
                                                    密&nbsp;&nbsp;&nbsp;&nbsp;码：
                                                </td>
                                                <td>
                                                    <input name="password" id="password" type="password" />
                                                    <font color="red">*</font>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr bgcolor="#f5f7f8">
                                    <td align="center" colspan="2">
                                        <input type="button" value="&lt;&lt;上一步" onclick="location.href='/Reg'" class="btn01"
                                            name="Submit1" />
                                        <input type="button" value="下一步&gt;&gt;" onclick="save()" class="btn01" name="Submit" />
                                        <input type="hidden" name="sltinfo" id="sltinfo" />
                                    </td>
                                </tr>
                            </table>
                            <%} %>
                        </td>
                    </tr>
                </table>
                <table width="750" cellspacing="0" cellpadding="0" border="0" align="center">
                    <tr>
                        <td height="30" align="center">
                            安徽新闻出版职业技术学院——运动会管理平台
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>

    <script type="text/javascript" language="javascript">
        $(document).ready(function() {
            $('#playerspec').change(function() {
                getClass("playerspec");
            });
            $('#playergrade').change(function() {
                getClass("playerspec");
            });
        });
        function getClass(obj) {
            $.ajaxSetup({ cache: false });
            var selectedItem = $("#" + obj).val();
            if (selectedItem == "" || selectedItem == 0) {
                $("#playerclass").html("");
                $("#playerclass").attr('disabled', "disabled");
            } else {
                var sltspecid = $("#playerspec > option:selected").attr("value");
                var sltgrade = $("#playergrade > option:selected").attr("value");
                $.ajax({
                    type: "post",
                    dataType: "json",
                    url: '<%=Url.Action("GetClassInfo")%>',
                    data: { "specid": sltspecid, "gradeid": sltgrade },
                    success: function(data) {
                        var items = "";
                        if (data == null)
                            return;
                        $.each(data, function(i, data) {
                            items += "<option value='" + data.id + "'>" + data.name + "</option>";
                        });
                        $("#playerclass").html(items);
                        $("#playerclass").removeAttr('disabled');
                    }
                });
            }
        }
    </script>

</body>
</html>